<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<link th:href="@{/css/style.css}" rel="stylesheet" type="text/css" />
<script type="text/javascript" th:src="@{/js/jquery.js}"></script>
</head>

<body>
<div class="place"> <span>位置：</span>
  <ul class="placeul">
    <li>营销管理</li>
    <li>订购单审核管理</li>
    <li>审核</li>
  </ul>
</div>
<div class="formbody">
  <form th:action="@{/orderExamine/updateOrder}" method="post" id="orderFrom">
    <div class="formtitle"><span>订购单审核</span></div>
    <input type="hidden" id="ordertimeStr" name="chectime" />
    <input type="hidden" name="orderId" id="orderId" th:value="${order.orderid}" />
    <ul class="forminfo">
      <li>
        <label>订单编号</label>
        <cite th:text="${order.orderid}"  th:value="${order.orderid}">DJ201711180001</cite>
      </li>
      <li>
        <label>客户姓名</label>
        <cite><a th:href="@{'/custom/toShow?customId='+${order.customid}}" th:text="${order.custom.customname}" title="点击查看客户详细信息" class="tablelink">王金平</a></cite>
      </li>
      <li>
        <label>联系电话</label>
        <cite th:text="${order.custom.telephone}">17370899727</cite>
      </li>
      <li>
        <label>订购时间</label>
        <cite th:text="${order.ordertime==null?'': #dates.format(order.ordertime,'yyyy-MM-dd HH:mm:ss')}">2017-11-18 15:36:10</cite>
      </li>
      <li>
        <label>总金额</label>
        <cite th:with="num=1000">￥[[${#numbers.formatInteger(order.ordermoney,1,'COMMA')}]]</cite>
      </li>
      <li>
        <label>操作人</label>
        <cite th:text="${order.operatorUser.uname}">关羽</cite>
      </li>
    </ul>
    <table class="tablelist">
      <thead>
        <tr>
          <th>序号</th>
          <th>品牌</th>
          <th>类型</th>
          <th>型号</th>
          <th>数量</th>
          <th>单位</th>
          <th>单价</th>
          <th>金额</th>
        </tr>
      </thead>
      <tbody>
        <tr th:each="orderdetails:${order.orderdetailsList}">
          <td th:text="${orderdetailsStat.count}"></td>
          <td th:text="${orderdetails.cProduct.cType.cBrand.brandName}"></td>
          <td th:text="${orderdetails.cProduct.cType.typeName}"></td>
          <td th:text="${orderdetails.cProduct.productModel}"></td>
          <td th:text="${orderdetails.purchaseNum}"></td>
          <td>台</td>
          <td th:text="${orderdetails.proprice}"></td>
          <td th:text="${orderdetails.prototal}"></td>
        </tr>
      </tbody>
    </table>
    <ul class="forminfo">
      <li>
        <label>审核意见</label>
        <textarea class="textinput" id="opinion" name="opinion"></textarea>
        <i id="opinionHint"></i>
      </li>
      <li>
        <label>审核状态</label>
        <select class="dfselect" name="status" id="status" >
          <option value="" selected >请选择</option>
          <option value="审核通过">通过</option>
          <option value="审核未通过">不通过</option>
        </select>
        <i id="statusHint"></i>
      </li>
      <li>
        <label>&nbsp;</label>
        <input name="" type="" class="btn" value="审核" onclick="toSubmit()"/>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <input name="" type="button" class="btn" value="返回" onclick="window.location.href='customerList.html'"/>
      </li>
    </ul>
  </form>
</div>
<script type="text/javascript">
	$('.tablelist tbody tr:odd').addClass('odd');


  function toSubmit () {

      var opinion = $('#opinion').val();
      var status = $('#status').val();
      if(opinion == "" ){
        $('#opinionHint').text("审核意见不能为空！！")
      }
      if(status == "" ){
        $('#statusHint').text("请选择审核状态！！")
      }
      if(opinion != "" &&   status != "" ){
        $('#orderFrom').submit();
      }
    }

    var nowTime = new Date();
    var year = nowTime.getFullYear();
    var month = nowTime.getMonth()+1;
    var day = nowTime.getDate();
    var hour = nowTime.getHours();
    var minutes = nowTime.getMinutes();
    var second = nowTime.getSeconds();
    if(month>0 && month<10){
      month = "0"+month;
    }
    if(day>0 && day<10){
      day = "0"+day;
    }
    if(hour>0 && hour<10){
      hour = "0"+hour;
    }
    if(minutes>0 && minutes<10){
      minutes = "0"+minutes;
    }
    if(second>0 && second<10){
      second = "0"+second;
    }
    /* 订购时间 */
    var nowDate = year+"-"+month+"-"+day+" "+hour+":"+minutes+":"+second;
    $("#ordertimeStr").val(nowDate);
</script>

</body>
</html>
